package com.gold.gauss.service;

import com.gold.gauss.dao.StackItemDao;
import com.gold.gauss.model.StackItem;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

/**
 * Created by Gary on 2019-12-24.
 *
 * @author Gary
 * @version 0.0.1
 * @date 2019-12-24
 * @since 0.0.1
 */
@Service
public class StackItemService {
    @Autowired
    private StackItemDao stackItemDao;

    public int create(StackItem stackItem) {
        return stackItemDao.create(stackItem);
    }

    public int delete(Long id) {
        return stackItemDao.delete(id);
    }

    @Transactional(propagation = Propagation.SUPPORTS)
    public int deleteByBookId(Long bookId) {
        return stackItemDao.deleteByBookId(bookId);
    }
}
